package mojito;

import org.apache.kafka.clients.producer.Callback;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;

import java.io.*;
import java.util.Properties;


/**
 * @author huangguo
 * @time 19-7-26 下午4:14
 */
public class Main {
    public static void main(String [] args){
        KafkaProducerTest kafkaProducerTest = new KafkaProducerTest();
        String topic = "mojituo";
        FileInputStream inputStream = null;
        try {
            inputStream = new FileInputStream("/home/guoguo/insight/deposit-service/deposit-web/deposit-web-error.log");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        String str = null;
        String key = "test";
        try {
            while((str = bufferedReader.readLine()) != null){
                kafkaProducerTest.sendMsg(topic, key.getBytes(), str.getBytes());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
